home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / WSETSCRR.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  66 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3. #undef wsetscrreg
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid_wsetscrr = "$Header: c:/curses/portable/RCS/wsetscrr.c%v 2.0 1992/11/15 03:29:29 MH Rel $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   wsetscrreg() - set scrolling region
  15.  
  16.   X/Open Description:  setscrreg(), wsetscrreg()
  17.        These functions allow the suer to set a software scrolling region
  18.        in a window.  The parameters 'top' and 'bot' are the line numbers
  19.        of the top and bottom margin of the scrolling region.  (Line 0 is
  20.        the top line of the window.)  If this option and scrollok() are
  21.        enabled, an attempt to move off the bottom margin will cause all
  22.        lines in the scrolling region to scroll up one line.  Only the
  23.        text of the window is scrolled.
  24.  
  25.   PDCurses Description:
  26.        PDCurses implements the standard OK and ERR return values.
  27.  
  28.        FYI: setscrreg() is also defined as a macro.
  29.  
  30.   X/Open Return Value:
  31.        No return values are defined for these functions.
  32.  
  33.   PDCurses Errors:
  34.        It is an error to pass a NULL WINDOW pointer.
  35.        The top and bottom coordinates must be inside the passed window
  36.        and must bound the window's cursor position.  e.g.  The cursor
  37.        cannot be above or below the top or bottom margins.
  38.  
  39.   Portability:
  40.        PDCurses        int wsetscrreg( WINDOW* win, int top, int bottom );
  41.        X/Open Dec '88  int wsetscrreg( WINDOW* win, int top, int bottom );
  42.        SysV Curses     int wsetscrreg( WINDOW* win, int top, int bottom );
  43.        BSD Curses      int wsetscrreg( WINDOW* win, int top, int bottom );
  44.  
  45. **man-end**********************************************************************/
  46.  
  47. int    wsetscrreg(WINDOW *win, int top, int bottom)
  48. {
  49.        if (win == (WINDOW *)NULL)
  50.                return (ERR);
  51.  
  52.        if ((0 <= top) &&
  53.            (top <= win->_cury) &&
  54.            (win->_cury <= bottom) &&
  55.            (bottom < win->_maxy))
  56.        {
  57.                win->_tmarg = top;
  58.                win->_bmarg = bottom;
  59.                return (OK);
  60.        }
  61.        else
  62.        {
  63.                return (ERR);
  64.        }
  65. }
  66.